<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=640,maximum-scale=1.0, user-scalable=no">
		<title>我的产品-浏览海报</title>
		<link rel="stylesheet" href="css/reset.css" />
		<link rel="stylesheet" href="css/browerpage.css" />
		<script type="text/javascript">
	   		var config  ={};
		    (function(){
		      var config_width = 640,
		        config_height = 0,
		        html = document.documentElement,
		        delay, setSize = function() {
		          config.windowWidth = html.clientWidth || window.innerWidth || html.getBoundingClientRect().width;
		          config.windowHeight = html.clientHeight || window.innerHeight || html.getBoundingClientRect().height;
		          config.aspectRatio = config.windowWidth / config.windowHeight;
		    
		          if (!config_width || config.aspectRatio > config_width / config_height) {
		            config.windowScale = config_height / config.windowHeight;
		            html.style.cssText += 'font-size:' + config.windowHeight * 100 / config_height + 'px!important;';
		          } else {
		            config.windowScale = config_width / config.windowWidth;
		            html.style.cssText += 'font-size:' + config.windowWidth * 100 / config_width + 'px!important;';
		          }
		          html.offsetWidth;
		        }
		      if (!config_height && !config_width) {
		        config_width = 640;
		      }
		      setSize();
		      document.addEventListener('DOMContentLoaded', function() {
		        window.addEventListener('resize', function() {
		          clearTimeout(delay);
		          delay = setTimeout(setSize, 50);
		        }, false);
		      }, false);      
		    })();
	   	</script>
	</head>
	<body>
		<div id="web">
			<div class="img-wrap"><img src="img/list.jpg" alt="" /></div>
			<div class="link-wrap">
				<a href="index.html">制作属于您的广交会海报</a>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="js/jquery-1.12.4.min.js" ></script>
	<script type="text/javascript">
		
		var $img = $('#web img');
		var $text = $('#web a');
		$.ajax({
			type: "post",
			url: "http://m2.t1.laisj.com/publics/cantonfair/getposter",
			async: true,
			data: {
				id: getUrlParam('id')
			},
			success: function(res) { //成功得到返回时运行
				if(res.code == 200) {
					$img.attr('src',res.msg[getUrlParam('index')]);
					var languageType = getUrlParam('languageType');
					if(languageType==0){
						$text.text('制作属于您的广交会海报');
						$('title').html('我的产品-浏览海报'); 
					}else{
						$text.text('Create a poster');
						$('title').html('My product-View the poster'); 
					}
					
				}
			},
			ajaxError: function(a, b, c) {
				console.log(a); //错误的对象
				console.log(b); //错误的类型
				console.log(c); //错误的信息
			},
		});
		
		
		//获取链接参数的方法
		function getUrlParam(name){
			var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");  //构造一个含有目标参数的正则表达式对象
			var r = window.location.search.substr(1).match(reg);   //匹配目标参数
			//返回参数值
			if (r!=null){
				return unescape(r[2]);
			}else{
				return null;      
			}  
		} 
		
		
	</script>
</html>
